import request from '@/utils/request';

export async function queryDictList(params: any): Promise<any> {
  params.page = params.current;
  params.limit = params.pageSize;
  delete params.current;
  delete params.pageSize;
  const res = await request('/api/dict/list', {
    method: 'POST',
    params: params,
  })
  let data = res.results
  res.data = data;
  res.total = res.len;
  return res
}

export async function deleteDict(params: any) {
  return request('/api/dict/del?id='+params.id, {
    method: 'POST',
    data: params,
  })
}

export async function saveDict(params: any) {
  params.id = parseInt(params.id||'0')
  return request('/api/dict/save', {
    method: 'POST',
    data: params,
  })
}

export async function getDict(params: any) {
  return request('/api/dict/get?id='+params.id, {
    method: 'POST',
    data: params,
  })
}

